<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org" xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity3">
<head th:replace="top::html" />
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
<body class="fixed hold-transition skin-blue">

	<div class="wrapper">
		<div th:replace="tophtml::html"></div>
		<div th:replace="left::html"></div>
		<div class="content-wrapper">
			<section class="content-header">
				<h1>
                    <span>需求匹配专家</span> 
                    <small></small>
                </h1>
                <ol class="breadcrumb">
                    <li><a th:href="@{/index}"><i class="fa fa-dashboard"></i>用户中心</a></li>
                    <li><a th:href="@{/demand/showQuery}"><i class="fa fa-dashboard"></i>需求管理</a></li>
                    <li><a href="">需求匹配专家</a></li>
                </ol>
                <div>
                	<b>需求名称:</b> <a th:href="@{'/demand/showConditionQuery?searchKeyword=D'+${demand.demandNumber}}" th:text="${demand.demandName}">查看详情</a>
                	<a class="btn btn-primary" th:href="@{'/demand/showProjectButtDetail?demandId='+${demand.pid}}">已匹配</a>
                	<br>
                	<b>需求内容:</b> <span th:title="${demand.demandContent}" th:text="${#strings.length(demand.demandContent)} > 20 ? ${#strings.substring(demand.demandContent, 0, 20)}+'...' : ${demand.demandContent}"></span>
                </div>
			</section>
			<section class="content container-fluid">
				<p style="color: red;" th:text="${searchEmpty}"></p>
				<form id="from1" class="form-inline" th:action="@{/person/searchMatchedExpert}" method="get">
					<input type="hidden" name="pageNo" id="pageNo" />
					<input type="hidden" name="demandId" th:value="${demand.pid}" />
                    <div class="form-group">
						<label style="font-weight: lighter;"> 
							<input type="radio" name="demandMatch" th:value="@{'/customer/showDemandMatchedProject?pid='+${demand.pid}+'&customerId='+${customerId}}"> 需求匹配项目 
						</label>
						<label style="font-weight: lighter;"> 
							<input type="radio" name="demandMatch" checked> 需求匹配专家
						</label>
					</div><br/>
					<div class="form-group">
						<label>专家类型</label> 
						<select name="type" th:field="${person.type}" class="form-control" style="width: 202px;">
							<option th:value=null>-请选择-</option>
							<option th:each="psd : ${personTypeList}" th:value="${psd.pid}" th:text="${psd.worth}"></option>
						</select>
					</div><br/>
					<div class="form-group">
                        <label>所属领域</label>
                        <span th:each="rfd : ${researchFieldDictiontryList}">
                            <label style="font-weight: lighter;">
	                            <input type="checkbox" name="researchField" th:value="${rfd.names}" th:text="${rfd.worth}" th:checked="${researchFieldArr != null ? #arrays.contains(researchFieldArr, rfd.names) : false}">
                            </label>
                        </span>
                    </div>
					<div class="form-group">
                        <label>人才级别</label>
                        <span th:each="rfd : ${talentLevelListByDic}">
                            <label style="font-weight: lighter;">
	                            <input type="checkbox" name="talentLevel" th:value="${rfd.names}" th:text="${rfd.worth}" th:checked="${talentLevelArr != null ? #arrays.contains(talentLevelArr, rfd.names) : false}">
                            </label>
                        </span>
                    </div><br/>
					<div class="form-group">
						<label style="margin-left: 14.8px;">专家ID</label> 
						<input type="text" class="form-control" th:if="${person.expertNumber==null}" name="expertNumberId" th:value="${person.expertNumber}" style="width: 202px;"> 
						<input type="text" class="form-control" th:if="${person.expertNumber!=null}" name="expertNumberId" th:value="'E'+${person.expertNumber}" style="width: 202px;">
					</div>
					<div class="form-group">
						<label style="margin-left: 28.2px;">姓名</label> 
						<input name="name" type="text" th:value="${person.name}" class="form-control" style="width: 202px;"/>
					</div>
					<div class="form-group">
						<label style="margin-left: 27.8px;">单位</label> 
						<input name="unit" type="text" th:value="${person.unit}" class="form-control" style="width: 202px;"/>
					</div><br/>
					<div class="form-group">
						<label style="margin-left: 28px;">邮箱</label> 
						<input name="email" type="text" th:value="${person.email}" class="form-control" style="width: 202px;"/>
					</div>
					<div class="form-group">
						<label style="margin-left: 28.3px;">手机</label> 
						<input name="tell" type="text" th:value="${person.tell}" class="form-control" style="width: 202px;"/>
					</div>
					<div class="form-group">
						<label>专业领域</label> 
						<input name="professionaField" type="text" th:value="${person.professionaField}" class="form-control" style="width: 202px;"/>
					</div>
					
					<button type="submit" class="btn btn-primary" style="margin-left: 40px;">搜索</button>
                    <button type="reset" style="margin-left: 40px;" class="btn btn-primary">重置</button>
                    <input type="button" class="btn btn-primary" value="返回" onclick="window.history.go(-1)" style="margin-left: 40px;">
                    
					<br/>
					<div>
                        <span class="from-group">
	                        <label>所在地区</label>
	                        <label style="font-weight: lighter;">
		                        <input type="radio" name="domesticOrForeign" id="optionsRadios1" value="0" th:checked="${person != null ? person.domesticOrForeign == 0 : false}" style="margin-left: 15px;"> 国内
	                        </label>
	                        <label style="font-weight: lighter;">
		                        <input type="radio" name="domesticOrForeign" id="optionsRadios2" value="1" th:checked="${person != null ? person.domesticOrForeign == 1 : false}" style="margin-left: 15px;"> 国外
	                        </label>
                        </span>
                        <span class="form-group form-country">
                        	<label style="margin-left: 111px;">国家</label>
	                        <select class="form-area" style="width: 202px;height: 35px;">
	                            <option value="-1">--选择国家--</option>
	                            <option th:each="list:${countryDictiontryList}" th:value="${list.pid}" th:text="${list.worth}" th:selected="${list.pid eq country}"></option>
	                        </select>
                        </span><br/>
                        <span class="form-group form-area">
                        	<label style="margin-left: 42px;">省</label>	
	                        <select class="form-area" id="provinceId" style="width: 202px;height: 35px;">
	                            <option value="-1">--选择省--</option>
	                            <option th:each="list:${provinceDictiontryList}" th:value="${list.names}" th:text="${list.worth}" th:selected="${list.names eq province}"></option>
	                        </select>
                        </span>
                        <span class="form-group form-area">
                        	<label style="margin-left: 43px;">市</label>
	                        <select class="form-area" id="cityId" style="width: 202px;height: 35px;">
	                            <option value="-1">--选择市--</option>
	                            <option th:each="list:${cityDictiontryList}" th:value="${list.names}" th:text="${list.worth}" th:selected="${list.names eq city}"></option>
	                        </select>
                        </span>
                        <span class="form-group form-area">
                        	<label style="margin-left: 42px;">区</label>
	                        <select class="form-area" id="areaId" style="width: 202px;height: 35px;">
	                            <option value="-1">--选择区--</option>
	                            <option th:each="list:${areaDictiontryList}" th:value="${list.names}" th:text="${list.worth}" th:selected="${list.names eq district}"></option>
	                        </select>
                        </span>
                    </div>
				</form>
				<!-- 右侧列表部分 -->
				<div class="box">
					<div class="box-body">
					    <button id="dosubmit" class="btn btn-primary">匹配</button>
                        <span style="margin-left: 50px;font-size: 16px;">
	                   
                    
						<table class="table table-bordered">
							<tbody>
								<tr>
								    <th><input id="all" type="checkbox" th:disabled="${not #lists.isEmpty(buttedExpertIdList)}" /></th>
									<th>专家ID</th>
									<th>姓名</th>
									<th>单位</th>
									<th>专业领域</th>
									<th>人才级别</th>
									<th>科技成果</th>
									<th>参会情况</th>
									<th>匹配</th>
								</tr>
								<tr th:each="person : ${pageInfo.list}" th:class="${#lists.contains(buttedExpertIdList, person.pid) ? 'butt-gray' : ''}">
                                    <td><input type="checkbox" class="matched" th:disabled="${#lists.contains(buttedExpertIdList, person.pid)}" th:value="'demandId='+${demand.pid}+'&demandNumber='+${demand.demandNumber}+'&demandName='+${demand.demandName}+'&expertId='+${person.pid}+'&expertNumber='+${person.expertNumber}+'&name='+${person.name}" /></td>
		                            <td >
		                            <a th:href="@{/person/personDetails(pid=${person.pid})}" th:text="${'E'+person.expertNumber}"></a>
		                            </td>
		                            <td th:text="${person.name}"></td>
		                            <td th:text="${person.unit}"></td>
		                            <td th:title="${person.professionaField}" th:text="${not #strings.isEmpty(person.professionaField)} and ${#strings.length(person.professionaField)} > 30 ? ${#strings.substring(person.professionaField, 0, 30)} : ${person.professionaField}"></td>
		                            <td th:text="${person.talentLevel}"></td>
		                            <td th:text="${person.technica}"></td>
		                            <td><a th:href="@{/person/mateConference(pid=${person.pid})}">会议</a></td>
		                            <td>
                                    	<a href="javascript:void(0);" th:class="${not #lists.contains(buttedExpertIdList, person.pid)} ? singleMatch">匹配</a>
                                    </td>
		                        </tr>
							</tbody>
						</table>
					</div>
					<div th:replace="page::html"></div>	
				</div>	
			</section>
		</div>
		<div th:replace="footer::html"></div>
		<div class="control-sidebar-bg"></div> 
	</div>
	<div th:replace="bottom::html" ></div>
	<script type="text/javascript" th:inline="javascript">
        matchButt([[@{/person/demandMatchExpert}]]);
        $("a.singleMatch").one("click", function() {
        	$(this).closest("tr").find(":checkbox").prop("checked", true);
        	matching([[@{/person/demandMatchExpert}]]);
        });
    </script>
</body>
</html>